<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"  xmlns:ui="http://java.sun.com/jsf/facelets"                        
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html"      >
    <h:head>     
        <link href="#{facesContext.externalContext.requestContextPath}/resources/css/default.css" rel="stylesheet" type="text/css" />
        <link href="#{facesContext.externalContext.requestContextPath}/resources/css/cssLayout.css" rel="stylesheet" type="text/css" />
        <link href="#{facesContext.externalContext.requestContextPath}/resources/css/menu.css" rel="stylesheet" type="text/css" />
        <title>Blue Pumpkin Admin Page</title>
    </h:head>
    <h:body>
        <div class="main_body_admin" >
            <div class="separator_div"/>
            <div class="admin_logo"/>

            <h:form id="frmMain">
                <p:menubar style="text-align: center" >
                    <p:menuitem value="Event" actionListener="#{naviagtionControl.redirectToEventPage()}"  > </p:menuitem> 
                    <p:menuitem value="Prize" style="color: blueviolet; font-weight: bold" styleClass="admin_menu_current" ></p:menuitem> 
                    <p:menuitem value="User"   actionListener="#{naviagtionControl.redirectToUserPage()}" ></p:menuitem> 
                    <p:menuitem value="FAQ"  actionListener="#{naviagtionControl.redirectToFAQsPage()}" ></p:menuitem> 
                    <p:menuitem value="Contact" actionListener="#{naviagtionControl.redirectToContactPage()}"  ></p:menuitem> 
                    <p:menuitem value="Registration" actionListener="#{naviagtionControl.redirectToRegistrationPage()}" ></p:menuitem> 
                    <p:menuitem value="Winner" actionListener="#{naviagtionControl.redirectToWinnerPage()}"  ></p:menuitem> 
                    <p:menuitem value="Comment" actionListener="#{naviagtionControl.redirectToCommentsPage()}"  ></p:menuitem> 
                    <p:submenu label="#{userControl.user.fullName}"    >
                        <p:menuitem value="Edit Profile" actionListener="#{userControl.redirectToLogonUserPage()}" ></p:menuitem> 
                        <p:menuitem value="Log out" actionListener="#{userControl.logout()}"  ></p:menuitem> 
                    </p:submenu>


                </p:menubar>
            </h:form>

            <div class="content_display">
                <h:form>
                    <p:toolbar>
                        <p:toolbarGroup>
                            <p:commandButton value="New Prize" actionListener="#{prizeControl.redirectToAddPrize()}"/>
                            <p:commandButton value="View Prizes"  actionListener="#{prizeControl.redirectToListrizes()}" />

                        </p:toolbarGroup>
                    </p:toolbar>
                </h:form>
                <p:spacer height="5px" />
                <p:panel style="width: 99%;">
                    <h:form>
                        <p:growl autoUpdate="true" id="grl"/>
                        <!--                        <p:messages autoUpdate="true" id="mgss" />-->
                        <h:panelGrid columns="3">

                            <h:outputLabel value="Select Event :" for="evt" />                       
                            <p:autoComplete  id="evt" value="#{prizeControl.event}" itemLabel="#{p.title}" itemValue="#{p}" var="p"
                                             completeMethod="#{prizeControl.comlpleteMethod}" converter="#{prizeConverter}"  required="true" requiredMessage="You MUST select an event"
                                             dropdown="true"   maxResults="10"     forceSelection="true"/>  
                            <p:message for="evt" />
                            <h:outputLabel value="Title:" for="title" />
                            <p:inputTextarea rows="3" cols="33" value="#{prizeControl.prize.title}" id="title" required="true" requiredMessage="The Title is required">

                            </p:inputTextarea>
                            <p:message for="title" />

                            <h:outputLabel value="Create Date" for="prizeDate" />
                            <p:calendar id="prizeDate" value="#{prizeControl.prize.createdDate}" mindate="#{prizeControl.currentDate}"
                                        required="true" requiredMessage="The create Date is required."/>
                            <p:message for="prizeDate" />
                            <h:outputLabel value="Content" for="description" />
                            <p:editor value="#{prizeControl.prize.contents}" id="description"/>
                            <p:message for="description" />
                            <div/>
                            <p:commandButton value="Create" actionListener="#{prizeControl.insert()}" update="@form" />
                            <h:commandButton type="reset" value="Reset" style="padding: 0.4em 1em;" styleClass="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" >

                            </h:commandButton>
                        </h:panelGrid>




                    </h:form>

                </p:panel>

            </div>
        </div>
    </h:body>
</html>
